package com.jack.mapper;


import com.jack.pojo.Student;
import com.jack.queryParam.StudentQueryParam;
import com.jack.queryParam.StudentViolation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.ArrayList;
import java.util.List;


/**
 * 学生持久层
 */
@Mapper
public interface StudentMapper {

    /**
     * 新增学生
     * @param student
     */
    void addStudent(Student student);

    /**
     * 批量删除学生
     * @param ids
     */
    void deleteStudent(ArrayList<Integer> ids);

    /**
     * 更新学生信息
     * @param student
     */
    void updateStudent(Student student);

    /**
     * 更新学生违纪信息
     * @param stu
     */
    void updateStudentScore(StudentViolation stu);

    /**
     * 学生分页查询
     * @param studentQueryParam
     * @return
     */
    List<Student> pageStudents(StudentQueryParam studentQueryParam);

    /**
     * 统计班级学生人数
     * @param clazzId
     * @return
     */
    @Select("select count(*) from student where clazz_id=#{clazzId}")
    Integer countStuOfClazz(Integer clazzId);


    /**
     * 根据id查询学生信息
     * @param id
     * @return
     */
    @Select("select * from student where id=#{id}")
    Student getStudentById(Integer id);

}
